﻿using Entity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace webapi.Controllers
{
    //fg:admin:test push
    public class BaseContoller<T> : ControllerBase where T : BaseEntity
    {
        private DbContext _dbContext;
        protected DbSet<T> dbSet;

        public BaseContoller(DbContext dbContext)
        {
            _dbContext = dbContext;
            _dbContext.Database.BeginTransaction();
            dbSet = _dbContext.Set<T>();
        }

        protected void saveChanges() 
        {
            _dbContext.SaveChanges(); 
        } 
    }
}
